////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: ParameterParser V1.1.4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxfdconfig.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "camxfdconfig.h"
#include "parametersetmanager.h"

CAMXFDCONFIG_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FaceDetectionCtrlTypeClass::FaceDetectionCtrlTypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, 0, 0, 0, 0)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(maxNumberOfFaces);
    PARAMETER_INITIALIZE(maxFPSWithFaces);
    PARAMETER_INITIALIZE(maxFPSWithNoFaces);
    PARAMETER_INITIALIZE(multiCameraMaxFPSWithFaces);
    PARAMETER_INITIALIZE(multiCameraMaxFPSWithNoFaces);
    PARAMETER_INITIALIZE(lockDetectedFaces);
    PARAMETER_INITIALIZE(initialNoFrameSkipCount);
    PARAMETER_INITIALIZE(maxPendingFrames);
    PARAMETER_INITIALIZE(delayCount);
    PARAMETER_INITIALIZE(holdCount);
    PARAMETER_INITIALIZE(accuracy);
    PARAMETER_INITIALIZE(hwConfig);
    PARAMETER_INITIALIZE(swConfig);
    PARAMETER_INITIALIZE(FPFilter);
    PARAMETER_INITIALIZE(ROIGenerator);
    PARAMETER_INITIALIZE(managerConfig);
    PARAMETER_INITIALIZE(stabilization);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FaceDetectionCtrlTypeClass::FaceDetectionCtrlTypeClass(
    const CHAR* name,
    UINT32 modeId,
    UINT16 mode,
    UINT16 subMode,
    UINT32 group)
    : ParameterModule(name, MAJOR, MINOR, PATCH, modeId, mode, subMode, group)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(maxNumberOfFaces);
    PARAMETER_INITIALIZE(maxFPSWithFaces);
    PARAMETER_INITIALIZE(maxFPSWithNoFaces);
    PARAMETER_INITIALIZE(multiCameraMaxFPSWithFaces);
    PARAMETER_INITIALIZE(multiCameraMaxFPSWithNoFaces);
    PARAMETER_INITIALIZE(lockDetectedFaces);
    PARAMETER_INITIALIZE(initialNoFrameSkipCount);
    PARAMETER_INITIALIZE(maxPendingFrames);
    PARAMETER_INITIALIZE(delayCount);
    PARAMETER_INITIALIZE(holdCount);
    PARAMETER_INITIALIZE(accuracy);
    PARAMETER_INITIALIZE(hwConfig);
    PARAMETER_INITIALIZE(swConfig);
    PARAMETER_INITIALIZE(FPFilter);
    PARAMETER_INITIALIZE(ROIGenerator);
    PARAMETER_INITIALIZE(managerConfig);
    PARAMETER_INITIALIZE(stabilization);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FaceDetectionCtrlTypeClass::~FaceDetectionCtrlTypeClass()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* FaceDetectionCtrlTypeClass::GetName(
    const CHAR* type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ParameterFileSymbolTableEntry::GetType(temp, "fdconfigdata")) == 0)
    {
        name = "fdconfigdata";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDMedianFilter
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDMedianFilter(
    ParameterFileSymbolTableEntry* entry,
    FDMedianFilter* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->historyLength);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDAverageFilter
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDAverageFilter(
    ParameterFileSymbolTableEntry* entry,
    FDAverageFilter* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->historyLength);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDHysteresisFilter
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDHysteresisFilter(
    ParameterFileSymbolTableEntry* entry,
    FDHysteresisFilter* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->startA);
    result = result && entry->ReadUInt32(&structure->endA);
    result = result && entry->ReadUInt32(&structure->startB);
    result = result && entry->ReadUInt32(&structure->endB);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDTemporalFilter
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDTemporalFilter(
    ParameterFileSymbolTableEntry* entry,
    FDTemporalFilter* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->numerator);
    result = result && entry->ReadUInt32(&structure->denominator);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDStabilizationAttributeConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDStabilizationAttributeConfig(
    ParameterFileSymbolTableEntry* entry,
    FDStabilizationAttributeConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    structure->mode = (FDStabilizationMode)entry->ReadEnum(&result);
    result = result && entry->ReadUInt32(&structure->minStableState);
    result = result && entry->ReadUInt32(&structure->stableThreshold);
    result = result && entry->ReadUInt32(&structure->threshold);
    result = result && entry->ReadUInt32(&structure->stateCount);
    result = result && entry->ReadUInt32(&structure->useReference);
    structure->filterType = (FDStabilizationFilter)entry->ReadEnum(&result);
    result = result && LoadFDStabilizationAttributeConfig_valueStruct(entry, &structure->value);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDStabilizationAttributeConfig_valueStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDStabilizationAttributeConfig_valueStruct(
    ParameterFileSymbolTableEntry* entry,
    FDStabilizationAttributeConfig::valueStruct* structure)
{
    BOOL result = TRUE;
    result = result && LoadFDTemporalFilter(entry, &structure->temporalFilter);
    result = result && LoadFDHysteresisFilter(entry, &structure->hysteresisFilter);
    result = result && LoadFDAverageFilter(entry, &structure->averageFilter);
    result = result && LoadFDMedianFilter(entry, &structure->medianFilter);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDStabilizationConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDStabilizationConfig(
    ParameterFileSymbolTableEntry* entry,
    FDStabilizationConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->historyDepth);
    result = result && LoadFDStabilizationAttributeConfig(entry, &structure->position);
    result = result && LoadFDStabilizationAttributeConfig(entry, &structure->size);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDROIManagerConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDROIManagerConfig(
    ParameterFileSymbolTableEntry* entry,
    FDROIManagerConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->newGoodFaceConfidence);
    result = result && entry->ReadUInt32(&structure->newNormalFaceConfidence);
    result = result && entry->ReadUInt32(&structure->existingFaceConfidence);
    result = result && entry->ReadUInt32(&structure->angleDiffForStrictConfidence);
    result = result && entry->ReadUInt32(&structure->strictNewGoodFaceConfidence);
    result = result && entry->ReadUInt32(&structure->strictNewNormalFaceConfidence);
    result = result && entry->ReadUInt32(&structure->strictExistingFaceConfidence);
    result = result && entry->ReadFloat(&structure->faceLinkMoveDistanceRatio);
    result = result && entry->ReadFloat(&structure->faceLinkMinSizeRatio);
    result = result && entry->ReadFloat(&structure->faceLinkMaxSizeRatio);
    result = result && entry->ReadFloat(&structure->faceLinkRollAngleDifference);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDROIGeneratorConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDROIGeneratorConfig(
    ParameterFileSymbolTableEntry* entry,
    FDROIGeneratorConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->baseThreshold);
    result = result && entry->ReadUInt32(&structure->innerThreshold);
    result = result && entry->ReadUInt32(&structure->expandFaceSizePercentage);
    result = result && entry->ReadUInt32(&structure->expandBoxBorderPercentage);
    result = result && entry->ReadFloat(&structure->faceSpreadTolerance);
    structure->searchDensity = (FDSearchDensity)entry->ReadEnum(&result);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDFPFilterConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDFPFilterConfig(
    ParameterFileSymbolTableEntry* entry,
    FDFPFilterConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadUInt32(&structure->baseThreshold);
    result = result && entry->ReadUInt32(&structure->innerThreshold);
    result = result && entry->ReadUInt32(&structure->expandFaceSizePercentage);
    result = result && entry->ReadUInt32(&structure->expandBoxBorderPercentage);
    result = result && entry->ReadFloat(&structure->faceSpreadTolerance);
    structure->searchDensity = (FDSearchDensity)entry->ReadEnum(&result);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDProfileConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDProfileConfig(
    ParameterFileSymbolTableEntry* entry,
    FDProfileConfig* structure)
{
    BOOL result = TRUE;
    structure->searchAngle = (FDSearchAngle)entry->ReadEnum(&result);
    result = result && entry->ReadUInt32(&structure->upFrontSearchAnggle);
    result = result && entry->ReadInt32(&structure->priorityAngleRange);
    result = result && entry->ReadInt32(&structure->priorityThreshold);
    result = result && entry->ReadInt32(&structure->priorityInnerThreshold);
    result = result && entry->ReadInt32(&structure->nonPriorityThreshold);
    result = result && entry->ReadInt32(&structure->nonPriorityInnerThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDFaceSize
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDFaceSize(
    ParameterFileSymbolTableEntry* entry,
    FDFaceSize* structure)
{
    BOOL result = TRUE;
    structure->type = (FDFaceSizeType)entry->ReadEnum(&result);
    result = result && LoadFDFaceSize_valueStruct(entry, &structure->value);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDFaceSize_valueStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDFaceSize_valueStruct(
    ParameterFileSymbolTableEntry* entry,
    FDFaceSize::valueStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->size);
    result = result && entry->ReadFloat(&structure->ratio);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDSwConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDSwConfig(
    ParameterFileSymbolTableEntry* entry,
    FDSwConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && LoadFDFaceSize(entry, &structure->minFaceSize);
    result = result && LoadFDFaceSize(entry, &structure->maxFaceSize);
    result = result && LoadFDProfileConfig(entry, &structure->frontProfileConfig);
    result = result && LoadFDProfileConfig(entry, &structure->halfProfileConfig);
    result = result && LoadFDProfileConfig(entry, &structure->fullProfileConfig);
    result = result && entry->ReadBoolean(&structure->enableUpFrontAngles);
    result = result && entry->ReadBoolean(&structure->skipIfNoOrientation);
    structure->detectionMode = (FDDetectionMode)entry->ReadEnum(&result);
    structure->newFaceSearchDensity = (FDSearchDensity)entry->ReadEnum(&result);
    structure->existingFaceSearchDensity = (FDSearchDensity)entry->ReadEnum(&result);
    result = result && entry->ReadBoolean(&structure->detectNewFacesInExistingFaceDirection);
    result = result && entry->ReadUInt32(&structure->noFaceSearchCycle);
    result = result && entry->ReadUInt32(&structure->newFaceSearchCycle);
    result = result && entry->ReadUInt32(&structure->newFaceSearchInterval);
    result = result && entry->ReadUInt32(&structure->upFrontNoFaceSearchCycle);
    result = result && entry->ReadUInt32(&structure->upFrontNewFaceSearchCycle);
    result = result && entry->ReadUInt32(&structure->upFrontNewFaceSearchInterval);
    result = result && entry->ReadUInt32(&structure->positionSteadiness);
    result = result && entry->ReadUInt32(&structure->sizeSteadiness);
    result = result && entry->ReadBoolean(&structure->rollAngleExtension);
    result = result && entry->ReadBoolean(&structure->yawAngleExtension);
    result = result && entry->ReadUInt32(&structure->noFaceFrameSkip);
    result = result && entry->ReadUInt32(&structure->newFaceFrameSkip);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FDHwConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFDHwConfig(
    ParameterFileSymbolTableEntry* entry,
    FDHwConfig* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && LoadFDFaceSize(entry, &structure->minFaceSize);
    result = result && LoadFDFaceSize(entry, &structure->maxFaceSize);
    result = result && entry->ReadBoolean(&structure->enableUpFrontAngles);
    structure->angle = (FDSearchAngle)entry->ReadEnum(&result);
    result = result && entry->ReadUInt32(&structure->upFrontAngle);
    result = result && entry->ReadUInt32(&structure->threshold);
    result = result && entry->ReadUInt32(&structure->noFaceFrameSkip);
    result = result && entry->ReadUInt32(&structure->newFaceFrameSkip);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load FaceDetectionCtrlType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::LoadFaceDetectionCtrlType(
    ParameterFileSymbolTableEntry* entry,
    FaceDetectionCtrlType* structure)
{
    BOOL result = TRUE;
    result = result && Loadmodule_versionStruct(entry, &structure->module_version);
    result = result && entry->ReadUInt32(&structure->maxNumberOfFaces);
    result = result && entry->ReadUInt32(&structure->maxFPSWithFaces);
    result = result && entry->ReadUInt32(&structure->maxFPSWithNoFaces);
    result = result && entry->ReadUInt32(&structure->multiCameraMaxFPSWithFaces);
    result = result && entry->ReadUInt32(&structure->multiCameraMaxFPSWithNoFaces);
    result = result && entry->ReadBoolean(&structure->lockDetectedFaces);
    result = result && entry->ReadUInt32(&structure->initialNoFrameSkipCount);
    result = result && entry->ReadUInt32(&structure->maxPendingFrames);
    result = result && entry->ReadUInt32(&structure->delayCount);
    result = result && entry->ReadUInt32(&structure->holdCount);
    structure->accuracy = (FDFaceAccuracy)entry->ReadEnum(&result);
    result = result && LoadFDHwConfig(entry, &structure->hwConfig);
    result = result && LoadFDSwConfig(entry, &structure->swConfig);
    result = result && LoadFDFPFilterConfig(entry, &structure->FPFilter);
    result = result && LoadFDROIGeneratorConfig(entry, &structure->ROIGenerator);
    result = result && LoadFDROIManagerConfig(entry, &structure->managerConfig);
    result = result && LoadFDStabilizationConfig(entry, &structure->stabilization);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL FaceDetectionCtrlTypeClass::Loadmodule_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    FaceDetectionCtrlType::module_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);
    result = result && entry->ReadInt32(&structure->incr_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Parse symbol table entry, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* FaceDetectionCtrlTypeClass::Parse(
    ParameterSetManager* manager,
    ParameterFileSymbolTableEntry* entry) const
{
    FaceDetectionCtrlTypeClass* cls = NULL;

    if (PARAMETER_STRCMP(Type, entry->Type) == 0 && Major == entry->Major &&
        Minor == entry->Minor && Patch == entry->Patch)
    {
        cls = PARAMETER_NEW FaceDetectionCtrlTypeClass(GetName(entry->Type), 
            entry->ModeId, entry->Mode, entry->SubMode, entry->Group);
        if (cls != NULL)
        {
            BOOL result = TRUE;

            cls->SymbolTableID = entry->ID;
            cls->ID            = entry->ID;

            result = result && LoadFaceDetectionCtrlType(entry, cls);

            if (!result)
            {
                PARAMETER_DELETE cls;
                cls = NULL;
            }
        }
    }
    return (ParameterModule*)cls;
}


CAMXFDCONFIG_NAMESPACE_END
